Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

329
Visualizações
jsPDF | dataKey of autoTable not work in angular

My PDF does not change when I use columnStyles with dataKey property, but my code works properly when I use the number instead of dataKey .

This is code that works incorrectly:

head = [{title: 'توضیحات', dataKey: 'MoreDescribe'},
{title: 'امکانات', dataKey: 'properties'},
{title: 'مبلغ خرید', dataKey: 'id'}]

body = [
[{content: ' قابل استفاده'},
{content: 'اندازه مناسب'},
{content: '10000 تومان'}],

[{content: ' قابل استفاده'},
{content: 'اندازه مناسب'},
{content: '10000 تومان'}],

[{content: ' قابل استفاده'},
{content: 'اندازه مناسب'},
{content: '10000 تومان'}]
]

printAll(){
const doc = new jsPDF();
autoTable(doc, {
      head: [this.head],
    body: this.body,
      headStyles: { font: 'Shabnam',halign: 'center',valign: "middle"}, // work
      bodyStyles: { font: 'Shabnam', halign: 'center', valign: "middle" }, // work

      columnStyles: {  id: { cellWidth: 5000 },properties:{cellWidth:700},MoreDescribe:{cellWidth:500} } // not work
    })
}

my result is: enter image description here

if I change the

columnStyles: { id: { cellWidth: 5000 },properties:{cellWidth:700},MoreDescribe:{cellWidth:500} }

to

columnStyles: { 1: { cellWidth: 5000 },2:{cellWidth:700},3:{cellWidth:500} }

cellWidth style applies to my table. but I want to use dataKey. how can I do it?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda